﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using IFViewDetail.KuaiQi.Others;
using HCY.CTP.DBShangZheng;
using IFClientDLL;
using IFServerDLL.DB;

namespace IFViewDetail.Ctl.KuaiQi.Others
{
    public partial class CtlMarketData : CtlBase
    {
        public CtlMarketData()
        {
            InitializeComponent();
        }
        public override void InitTryIF(ITryIF tryIF)
        {
            base.InitTryIF(tryIF);
            tryIF.DataServer.OnReceiveDBData += new Action<MyDBData>(Tryif_OnReceiveData);
            
        }

        void Tryif_OnReceiveData(MyDBData obj)
        {
            for (int i = 0; i < bindingSource.Count; i++)
            {
                MyDBData x = bindingSource[i] as MyDBData;
                if (x.Instrument == obj.Instrument)
                {
                    bindingSource[i] = obj;
                    gridView1.RefreshRow(i);
                    return;
                }
            }
            bindingSource.Add(obj);
            
        }

        


       
        public MyDBData GetFocuseRow()
        {
            return gridView1.GetFocusedRow() as MyDBData;
        }
    }
}
